Skip to content

ci: exclude test sources from coverage and document ignore rationale#125

Merged
grzanka merged 1 commit into
mainfrom
claude/codecov-ignore-tests
Jun 4, 2026
Merged

ci: exclude test sources from coverage and document ignore rationale#125
grzanka merged 1 commit into
mainfrom
claude/codecov-ignore-tests

Conversation

@grzanka
Copy link
Copy Markdown
Contributor

@grzanka grzanka commented Jun 4, 2026

What

Adds tests/** to the Codecov ignore: list (consolidating the two previously-listed tests/install_* entries) and documents why each path group is excluded, directly in .codecov.yml.

Why

Codecov doesn't instrument anything itself — the coverage CMake preset compiles everything with --coverage, ctest runs, and the gcov/lcov report is uploaded. Because the test .c files are compiled with the same flags and tests/** was not ignored, coverage was being measured on the test harness itself.

That's circular and misleading: assertion helpers and their "test failed" branches are dead code on a green run, so they only depress the patch/project percentages without saying anything about how well src/ and include/ are covered. (This is exactly what produced the spurious "missing lines" on the accessor PR #124 — every uncovered line was in the test file's failure paths, not the library.)

Best practice is to gate coverage on library code only. This change makes the metric reflect that.

Notes

  • For genuinely unreachable library lines (defensive error paths, OOM guards), the repo already uses in-source /* LCOV_EXCL_LINE */ and LCOV_EXCL_START/STOP (e.g. src/dedx_periodic_table.c, src/dedx_mstar.c, src/dedx_validate.c). The added comment points contributors there rather than excluding whole files.
  • examples/** was already ignored; tests/** now matches that same "not the library under test" rationale.
  • Config-only change; YAML validated. No source touched.

This is the policy change discussed on #124, split out so it can be reviewed on its own merits.


Authored via Claude Code.


Generated by Claude Code

Coverage should measure how well the suite exercises the shipped library, not
the test harness. Counting tests/** is circular: assertion helpers and their
"test failed" branches are dead code on a green run, so they only depress the
patch/project numbers without telling us anything about src/ or include/.

Add tests/** to the ignore list (subsuming the previously-listed
tests/install_* helpers) and document why each group is excluded, plus the
in-source /* LCOV_EXCL_LINE */ convention for unreachable library lines.

https://claude.ai/code/session_01XdTFfBgkL344BjVrxARiNc
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.73%. Comparing base (335be0b) to head (eb3a311).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #125      +/-   ##
==========================================
- Coverage   77.27%   72.73%   -4.55%     
==========================================
  Files          30       12      -18     
  Lines        3019     1643    -1376     
  Branches      403      300     -103     
==========================================
- Hits         2333     1195    -1138     
+ Misses        597      448     -149     
+ Partials       89        0      -89     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the repository’s Codecov configuration so coverage metrics reflect library code coverage (src/, include/) rather than coverage of the test harness itself, and documents the rationale inline for future contributors.

Changes:

  • Adds tests/** to Codecov’s ignore: list, consolidating the previously separate tests/install_* ignore entries.
  • Adds detailed comments explaining how coverage is produced in this repo and why specific path groups are excluded.
  • Adds brief inline rationale to the patch/project coverage thresholds to clarify intent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@grzanka grzanka merged commit 36990c2 into main Jun 4, 2026
25 checks passed
@grzanka grzanka deleted the claude/codecov-ignore-tests branch June 4, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants